package com.web.dao.impl;


import com.entity.Selleractivityrecord;
import com.mapper.SelleractivityrecordMapper;
import com.page.PageInfo;
import com.web.dao.SelleractivityrecordDao;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository("SelleractivityrecordDao")
public class SelleractivityrecordDaoImpl implements SelleractivityrecordDao {
    @Resource
    SelleractivityrecordMapper selleractivityrecordMapper;

    public List<Selleractivityrecord> getAll() throws Exception {
        return selleractivityrecordMapper.getAll();
    }

    /**
     *
     * @param pageInfo
     * @return
     */
  public    List<Selleractivityrecord> getSelleractivityrecordsByPage(PageInfo pageInfo) throws Exception {
      Map<String,Object> map = new HashMap<String,Object>();
      map.put("currPage",pageInfo.getCurrPage());
      map.put("pageSize",pageInfo.getPageSize());

      int itemCount = (int)selleractivityrecordMapper.countByExample(null);
      pageInfo.setItemCount(itemCount);
      return selleractivityrecordMapper.getSelleractivityrecordsByPage(map);
  }
}
